<template>
	<view>
		<!-- <view style="height: 170rpx;"></view>
		<view class="contact-list flex-col-center">
			<image src="../../../static/images/mine/kefu.png" mode="widthFix" class="kefu-img"></image>
			<view class="contact-text">此处显示客服联系方式</view>
			<view class="contact-text">18888888888</view>
		</view> -->

		<web-view v-if="url" :src="url"></web-view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [],
			limit: 10,
			token: '',
			url: '',
			userInfo: {}
		};
	},
	async onLoad() {
		await this.getInfo();
		await this.getUserInfo();
	},
	methods: {
		async getInfo() {
			var res = await this.$get('server/index/getkefutoken');
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				this.$refs.paging.complete(false);
				return;
			}
			this.token = res.token;
		},
		// 获取个人信息
		async getUserInfo() {
			var res = await this.$get('server/login/loaduser');
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				return;
			}
			this.userInfo = res.data.user;

			this.url = `http://kefu.dlhuoshi.com/yk_chat?token=${this.token}&yk_uid=${this.userInfo.id}&yk_avatar=${this.userInfo.headimgurl}&yk_name=${this.userInfo.nickname}`;
		}
	}
};
</script>

<style lang="scss" scoped>
.kefu-img {
	width: 236rpx;
	height: 234rpx;
	display: block;
	margin-bottom: 40rpx;
}
.contact-text {
	margin-bottom: 20rpx;
}
</style>
